All Questions
48 questions
0votes
1answer
749views
declare: not found error in Jenkins pipeline
I have a Jenkins pipeline which has a step running a sh script. Something like this, but with more commands in between which are not relevant: steps { echo 'Running build with all ...
0votes
3answers
730views
Read and convert date from file
I'm using a CentOS and I want to write a shell script. So I have a file with a date: > > cat VM1_EOMAP_TIME.log 07 Sep 2022 16:30 > And I want to get the minutes since current time and the ...
0votes
1answer
465views
Can I change system files from custom kickstart .iso?
I have set up a Kickstart .iso installation of CentOS 7 and it installs nicely (.iso is compiled with ks.cfg file inside). What I haven't figured out yet is if I could edit system files from within ...
0votes
0answers
313views
Linux Shell script to copy files from one location to another location and copy files detects same name to second directory then it will auto rename
I have a folder on my server which contains some files. Every day i get new files and i have renamed the same file to keep the updated same name file. In the same way, we have to update these same ...
0votes
1answer
68views
How to make a script which create a file with the info i want?
i'm a newbie on Linux here and i was hoping to find help. I was using Centos and i've found an exercise where i have to create a script. This script should create a text file with the network ...
0votes
0answers
1kviews
Restrict access to a ssh user to execute only one script
I'm new to linux admin so my question can seem dumb and i'm french so my english isn't good. I want to create an user account on my centos 7 server. That user will only have access to only one folder ...
0votes
2answers
1kviews
$'\r': command not found — file encoding on CentosOS trough cPanel for cloud service
I am writing a silly script trough cPanel on a Centoss remote server, no so much I can do about it, the script need changes from time to time, and upload trough ftp each time get annoying because of ...
1vote
2answers
256views
name a variable using the file name
I have a file with this format name Pocket_???_????_?.pdb_OUTPUT.txt and some directory with this format ????_?. I need to copy some of this file. For example, I have a list of file and I want to copy ...
-1votes
2answers
60views
Manipulating a txt file
I need to manipulate a lot of txt file in the same directory. Each file has the same format name (Pocket_????????.pdb_OUTPUT.txt) and the same inner structure. This is an example (file name: ...
0votes
0answers
51views
How to check if the set variable has a file assigned to it with the help of if condition
#!/bin/csh -fx set my_path = "/cd/home/dir" cd $my_path set path1 = `ls -1 | grep "abc" | head -1` set path2 = `ls -1 | grep "def" | head -1` 1)#how to check if path1 ...
0votes
0answers
338views
Run script at logout/shutdown in CentOS7
I have a couple of scripts that I would like to run on logout/shutdown and can't find the place to add them. I use mate-session-properties frequently to add scripts to run on startup - where is the ...
0votes
2answers
3kviews
How can I run su root and enter credentials in a script?
there's a script that I have and it needs to be run by root user. I just wanted to know how to run that script using su in the script. - I'm running CentOS7. The command I attempted (below) failed: su ...
0votes
3answers
196views
Print out IP address script [closed]
I need to make a script that gets my public IP address from a website and prints it out. #!/bin/bash wget http://www.ipchicken.com/ grep I don't know where to go from here. Please help
0votes
2answers
540views
how to remotely copy file to a remote linux machine and restart service afterward?
I would like to copy files using SCP to a remote Linux machine. I will regularly update hosts and dnsmasq.conf and use SCP to copy them to the remote machine: /etc/hosts /etc/dnsmasq.conf right ...
0votes
1answer
2kviews
script to move files to Google Drive
I have a CentOS 7 server, no desktop gui. It's used for inbound/outbound VOIP call recording, my plan is to copy today's recordings to my Google Drive. I have seen multiple Google Drive Linux ...